package com.runen.infinitemovement.adapter;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;
import com.runen.infinitemovement.model.entity.IntroduceEntity;
import com.runen.infinitemovement.tool.AppUtils;

/**
 * Create by LiaoDuanHong
 * Create on
 */
public class IntroduceMyRoadAdapter extends BaseMultiItemQuickAdapter<IntroduceEntity, BaseViewHolder> {
    private Activity context;

    public IntroduceMyRoadAdapter(Activity context) {
        super();
        this.context = context;
        addItemType(IntroduceEntity.ONE, R.layout.item_introduce_my_road_1);
        addItemType(IntroduceEntity.TWO, R.layout.item_introduce_my_road_2);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, IntroduceEntity introduceEntity) {
        ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(baseViewHolder.itemView, "alpha", 0f, 1f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(5000);
        animatorSet.play(alphaAnim);
        animatorSet.start();
        switch (baseViewHolder.getItemViewType()) {
            case IntroduceEntity.ONE:
                break;
            case IntroduceEntity.TWO:
                TextView tv_start = baseViewHolder.findView(R.id.tv_start);
                tv_start.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        AppUtils.jumpToMain(context);
                    }
                });
                break;
        }
    }
}
